﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>管理员列表-微街秀管理后台</title>
    <link href="../../Client/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="../css/admin.css" rel="stylesheet" type="text/css" />
    <style>
        /*分页*/
        .pager_style{width: 100%;height: 30px;margin-top: 10px;text-align: left;color: #909090;}
        .pager_style li{font-size: 14px;}
        .pager_style .page_num{height: 100%;font-size: 0;display: inline-block;float: left;}
        .pager_style .page_num li{height: 100%;border: 1px solid #eeeeee;padding: 0 10px;margin-right: 5px;line-height: 30px;display: inline-block;cursor: pointer;float: left;}
        .pager_style .page_num li:hover{border: 1px solid #f37b0b;background-color: #f37b0b;color: White;}
        /*分页 选中当页样式*/
        .pager_style .page_num .active{border: 1px solid #f37b0b;background-color: #f37b0b;color: White;cursor: default;}
        /*分页 不可用样式*/
        .pager_style .page_num .disable{background-color: #f1f1f1;}
        .pager_style .page_num .disable:hover{border: 1px solid #eeeeee;background-color: #f1f1f1;color: #909090;}
        .pager_style .page_info{display: inline-block;float: left;}
        .pager_style .page_info li{display: inline-block;margin-left: 10px;float: left;line-height: 30px;}
        table{border-collapse: collapse;border: none;width: 980px;text-align: center;}
        td{border: solid #ccc 1px;color: Black;height: 26px;}
        td a{text-decoration: none;}
        .td1, .td2, .td3, .td6{width: 100px;font-weight: bold;text-align: center;font-size: 13px;}
        .td4, .td5{width: 250px;font-weight: bold;text-align: center;}
    </style>
    <script src="../js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="../js/base.js" type="text/javascript"></script>
    <script src="../js/ajax-data.js" type="text/javascript"></script>
    <script src="../js/Pager.js" type="text/javascript"></script>
    <script src="../js/dialog.js" type="text/javascript"></script>
</head>
<body class="mainbody">
<div class="navigation"><a href="javascript:" class="back">后退</a>首页 &gt; 控制面板 &gt; <span class="headtitle">管理员列表</span></div>
<hr style="margin-top:0px;" />
  
    <div style="width: 980px; margin-left: auto; margin-right: auto;">
        <div style="height:30px;">
            会员编号:<input type="text" id="userid" name="userid" style="width: 80px;" />
            状态:<select id="state" name="state" style="width: 80px;">
                <option value="-1">不限</option>
                <option value="0" selected="selected">待审核</option>
                <option value="1">已审核</option>
                <option value="2">未通过</option>
            </select>
             提现平台:<select id="platform" name="platform" style="width: 80px;">
                <option value="-1">不限</option>
                <option value="1">微信</option>
                <option value="2">支付宝</option>
            </select>
            <input type="button" id="btn" value="搜 索" onclick="submits()" /></div>
     <div class="tab_con" style="display:block;">
        <table id="list">
        </table>
        <button onclick="alipayTx();">
            支付宝批量提现</button>
        <div class="pager_style">
            <ul class="page_num">
            </ul>
            <ul class="page_info">
                <li>总数:<span id="count">0</span></li>
                <li>每页:<span id="pageSize">0</span></li>
                <li>页数:<span id="pageToal">0</span></li>
            </ul>
        </div>
        </div>
        <input type="hidden" id="pagecount" value="0" />
    </div>
    <script>
        var pager = new Pager();
        $(function () {
            islogin();
            var sel = document.getElementById("state");
            for (var i = 0; i < sel.options.length; i++) {
                if (sel.options[i].value == getUrlArgStr("state"))
                    sel.selectedIndex = i;
            }
            GetList(1);
            if (getQueryString("state") == "1")
                $(".headtitle").html("已通过列表");
            else if (getQueryString("state") == "2")
                $(".headtitle").html("已拒绝列表");
        })

        function GetList(page) {
            var sel2 = document.getElementById("platform");
            for (var i = 0; i < sel2.options.length; i++) {
                if (sel2.options[i].value == getUrlArgStr("platform"))
                    sel2.selectedIndex = i;
            }

            var userid = $("#userid").val();
            var state = $("#state").val();

            var param = "page_index=" + page + "&userid=" + userid + "&state=" + state + "&platform=" + $("#platform").val();
            $("#list").html("");
            var html = "<tr><td class='td1'><input type='checkbox' id='all' onclick='SelectAll(this)'>选择</td><td class='td1'>会员编号</td><td class='td1'>姓名</td><td class='td1'>订单号</td><td class='td2'>提现金额</td><td class='td3'>平台</td><td class='td3'>状态</td><td class='td6'>审核人</td><td  class='td5'>审核时间</td><td class='td5'>申请时间</td><td style='width:120px;'>操作</td></tr>";
            AjaxStart("../ajax/fc_cash.ashx?getlist", param, function (data) {
                if (data.code != 0) {
                    $("#list").html(html + "<tr><td colspan='11'>" + data.msg + "</td></tr>");
                }
                else {
                    $("#list").html("");
                    var list = data.item.table;
                    for (var i = 0; i < list.length; i++) {
                        var platform = "";
                        if (list[i].platform == 1) platform = "微信";
                        else if (list[i].platform == 2) platform = "支付宝";

                        var state = "";
                        if (list[i].state == 0)
                            state = "待审核";
                        else if (list[i].state == 1)
                            state = "已审核";
                        else if (list[i].state == 2)
                            state = "<span style='color:red;'>未通过</span>";

                        html += "<tr>";
                        if ((list[i].platform == 2)) {
                            //支付宝支持多选提现
                            html += '<td><input type = "checkbox" name = "alipayOrders" value = "' + list[i].id + '"/></td>';
                        }
                        else
                            html += "<td></td>";
                        html += "<td>" + list[i].user_id + "</td>";
                        html += "<td>" + list[i].truename + "</td>";
                        html += "<td>" + list[i].orderid + "</td>";
                        html += "<td>" + list[i].amount + "元</td>";
                        html += "<td>" + platform + "</td>";
                        html += "<td>" + state + "</td>";
                        html += "<td>" + (list[i].check_adminid < 1 ? "" : list[i].check_adminid) + "</td>";
                        html += "<td>" + (list[i].check_date == null ? "" : list[i].check_date.replace("T", " ")) + "</td>";
                        html += "<td>" + list[i].date.replace("T", " ") + "</td>";
                        if (list[i].state > 0)
                            html += "<td style='color:#ccc;'>通过 | 拒绝</td>";
                        else {
                            var a = "";
                            if (list[i].platform == 2)
                                a = "<a href='ali_tixian.html?ids=" + list[i].id + "' target=\"_blank\">通过</a>";
                            else
                                a = "<a href='javascript:' onclick='check(1," + list[i].id + ")'>通过</a>";
                            html += "<td>" + a + " | <a href='javascript:' onclick=\"check(2," + list[i].id + ")\">拒绝</a></td>";
                        }
                        html += "</tr>";
                    }
                    $("#list").html(html);
                }
                pager.initPage(page, data.item.itemCount, 20, 5, GetList);
            });
        }

        function submits() {
            islogin();
            GetList(1);
        }

        //提现审核
        function check(type, id) {
            var msg = ""; //拒绝理由
            var param = "type=" + type + "&id=" + id;
            AjaxStart("../ajax/fc_cash.ashx?check", param, function (data) {
                if (data.code != 0)
                    Alert(data.msg);
                else
                    Alert("操作成功");
            });
        }

        //支付宝批量付款
        function alipayTx() {
            var ids = "";
            $("input[name = 'alipayOrders']").each(function () {
                if ($(this).is(':checked')) {
                    ids += "," + $(this).val();
                }
            });
            if (ids.length < 1) {
                alert("请选中要提现的订单!");
                return;
            }
            window.open("ali_tixian.html?ids=" + ids.substring(1));
        }

        function SelectAll(obj) {
            var chk = document.getElementsByName("alipayOrders");
            for (var i = 0; i < chk.length; i++)
                chk[i].checked = obj.checked;
        }
    </script>
</body>
</html>
